<template>
	<view class="">
		

		<view class="bg-white" v-if="gallery.content_data" >
		 <image class="cover" v-if="gallery.content_data.photo"   :src=" gallery.content_data.photo[0] + '?imageView2/2/w/1000'" mode="widthFix"></image>
		 <view class="text-center margin-bottom-sm">
			 
			 <view class="padding-sm">-{{gallery.content_data.date}}-</view>
			 <view class="cu-avatar sm round margin-left" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg)"></view>
			 <text class="margin-left-sm"> by {{gallery.content_data.author}}</text>
			
		
		 </view>
		  <view class="padding-sm">{{gallery.content_data.desc}}</view>	
		 <image @click="ViewImage(pic)" v-for="pic in gallery.content_data.photo_list" class="cover"   :src=" pic + '?imageView2/2/w/800'" mode="widthFix"></image>
			
		</view>
<view class="bottom-fix-h"></view>
		<view class="cu-bar bg-white tabbar border shop bottom-fix">
			<view class="action text-gray" @click="openurl('/pages/index/index','switchTab')">
				<view class="cuIcon-home"></view> 首页
			</view>

			<button class="action text-gray" open-type="contact">
				<view class="cuIcon-service ">

				</view>
				客服
			</button>


			<view @click="openurl('/pages/post/joinhands')"  class="bg-red submit">立即预约</view>
		</view>
	</view>
</template>

<script>
	import beeApp from '../../beeApp.js';
		 
	export default {
	 
		data() {
			return {

				userInfo: {},
				 page:1,
				 loading:0,
					loadingType: 'more',
				gallery: {},
				 


			};
		},
	 
		onLoad(option) {
			// beeApp.alert("yiqwyei");
			// this.getLeastUrls();
			this.id = option.id;
			this.load();

		},
		onPullDownRefresh() {
			this.load("reload");
			uni.stopPullDownRefresh();
		},

		methods: {
			//轮播图切换修改背景色
			swiperChange(e) {
				const index = e.detail.current;
				this.swiperCurrent = index;

			},
			ViewImage(url) {
				uni.previewImage({
					urls: this.gallery.content_data.photo_list,
					current: url
				});
			},
			openurl(url,type){
				if(type=="switchTab"){
					uni.switchTab({
						url:url
					})
				}else{
					uni.navigateTo({
						url:url
					})
				}
				
			},
			load: function(type) {
				 
				this.getGalleryList(type);
				 
			},
			
			
			getGalleryList(type) {
				var that = this;
				if(type=="reload"){
					that.gallery={};
				 
				}
				 
				this.loadingType = 'loading';
				beeApp.api(
					'sns/material-list/find', {
					 
						id: this.id,
						 
					},
					function(res) {
						
						if(res.code != 200) {
							 that.loadingType = 'more';
							beeApp.alert(res.msg);
							return;
						}
						that.gallery = res.data;
						uni.setNavigationBarTitle({
							title:res.data.content_data.desc
						})

					}
				);
			},
			

		}
	};
</script>

<style lang="scss">
	.cover{ 
		width: 100%;
	}
.bottom-fix-h {
		height: 80px;
	}

	.bottom-fix {
		position: fixed;
		width: 100%;
		bottom: 0px;
		left: 0px;
	}
</style>
